﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once

#include "GbmpDefines.h"
#include "OwnerPtr.h"
#include <QObject>
#include "GmProcessServeEventHandle.h"

namespace gcmp
{
    class GmProcessServerEvents : public QObject
    {
    public:
        ~GmProcessServerEvents();
        GmProcessServerEvents();

        bool RegisterProcessServerEventHandle(FunctionType functionType, OwnerPtr<IProcessServerEventHandle> opHandler);

        virtual void customEvent(QEvent* event) override;

        void Process(FunctionType functionType, OperationType operationType, OwnerPtr<NdbObject> opContent);

    private:
        std::map<FunctionType, OwnerPtr<IProcessServerEventHandle>> m_handlers;
    };
}
